package persistencia;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import bean.Catalogo;
import util.Conexion;

public class TALMADAO {
		
	public List<Catalogo> getAlmacenes() throws SQLException{
		List<Catalogo> almacenes = new ArrayList<Catalogo>();
		PreparedStatement pstm = Conexion.obtenerConexion().prepareStatement("select alcodi,alnomb from talma order by alcodi");
		ResultSet rs = pstm.executeQuery();
		while(rs.next()){
			Catalogo catalogo = new Catalogo();
			catalogo.setCodigo(rs.getString("alcodi"));
			catalogo.setDescripcion(rs.getString("alnomb"));
			almacenes.add(catalogo);
		}
		rs.close();
		pstm.close();
		return almacenes;
	}

}
